import { AxiosRequestConfig } from 'axios';
import request from '@/utils/request';

// 服务状态查询
export const getServiceMonitor = () => {
  return request({
    url: '/service/monitor',
    method: 'get',
  });
};

// 服务统计查询
export const getServiceStatistics = (val: any) => {
  return request({
    url: '/service/statistics?latest=' + val,
    method: 'get',
  });
};

export const getBytes = () => {
  return request({
    url: '/service/getBytes',
    method: 'get',
  });
};

// 通用/会话配置查询
export const getCommonConfig = () => {
  return request({
    url: '/service/getCommonConfig',
    method: 'get',
  });
};
// 通用/会话配置保存更新
export const updateCommonConfig = (data: any) => {
  return request({
    url: '/service/commonConfig',
    method: 'put',
    data,
  });
};

// 保留消息查询
export const getRetainer = () => {
  return request({
    url: '/service/getRetainer',
    method: 'get',
  });
};

// 保留消息保存更新
export const upadteRetainer = (data: any) => {
  return request({
    url: '/service/retainer',
    method: 'put',
    data,
  });
};

// 系统主题查询
export const getSysTopic = () => {
  return request({
    url: '/service/getSysTopic',
    method: 'get',
  });
};

// 系统主题保存更新
export const updateSysTopic = (data: any) => {
  return request({
    url: '/service/sysTopic',
    method: 'put',
    data,
  });
};

export function detail() {
  return request({
    url: '/publish/config/detail',
    method: 'get',
  });
}
export function update(data: any) {
  return request({
    url: '/publish/config/update',
    method: 'put',
    data: data,
  });
}

export function add(data: any) {
  return request({
    url: '/publish/config/add',
    method: 'post',
    data: data,
  });
}
